<template>
	<div>
		<div class="graybg"></div>
		<div class="header header_bg">
			<div class="header_left">
				<i onclick="javascript:history.back(-1)" class="iconfont baiColor">&#xe612;</i>
			</div>
			<div class="header_center">
				<span class="baiColor">设置支付密码</span>
			</div>
		</div>

		<div class="center " style="padding-top: 47px;">
			<p>支付密码用于账户提现，账单支付等</p>
			<form action="" method="">
				<div class="clearfix"  style="margin-top: 4px;">
					<label class="left">支付密码：</label>
					<input class="right" type="password" placeholder="支付密码" maxlength="6" v-model="pass" value="" />
				</div>
				<div class="clearfix">
					<label class="left">确认密码：</label>
					<input class="right"  type="password" placeholder="确认支付密码" maxlength="6" v-model="surepass" value="" />
				</div>
				<div class="footer_buton" @click="updatepass">确定</div>
			</form>
		</div>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				//需要验证填写的证件号码和数据中是否一致
				pass: '',	//支付密码
				surepass: '',	//确认支付
			}
		},
		methods: {
			updatepass(){
				let _this = this;
				var pass = this.pass;
				var surepass = this.surepass;
				if(pass != surepass){
					alert("两次密码输入不一致")
				}else if(pass == "" || surepass == ""){
					alert("密码不能为空")
				}else{
					var info = window.localStorage.data;
					var params = new URLSearchParams();
					params.append('token', info);	//客户秘钥（信息）
					params.append('type',1);
					params.append('pwd',surepass);
					this.$axios({
					   url:"Home/Money/alipay_pwd",
						method:"post",
						data:params
					   }).then(function(res){
					   	if(res.data == 1){
					   		alert("密码设置成功")
					   		_this.router.push("wShares");
					   	}else{
					   		alert("密码设置失败")
					   		_this.pass = "";
					   		_this.surepass = ""
					   	}		
					}).catch(function(err){
						console.log(err)		
					})
				}
				
			}
			
		},
	}
</script>

<style scoped="scoped">
	@import "../css/public.css";
	.center {
		width: 95%;
		margin: 0 auto;
	}
	
	div.active {
		border: solid 0.5px red !important;
		height: 40px;
	}
	
	.center>p {
		color: #666;
		font-size: 14px;
		padding: 6px 0 8px;
	}
	
	
	form>div {
		background: #FFFFFF;
		height: 44px;
		line-height: 44px;
		border-bottom: solid 1px #F0F0F0;
	}
	
	form label {
		color: #333;
		font-size: 16px;
		padding-left: 10px;
	}
	
	.left {
		float: left;
		width: 30%;
	}
	
	.right {
		width: 67%;
		float: left;
	}
	
	.center input {
		display: block;
		height: 44px;
		line-height: 44px;
		width: 65%;
	}
	
	input[value] {
		font-size: 16px;
	}
	
	input::-webkit-input-placeholder {
		color: #999;
		font-size: 16px;
	}

	.footer_buton {
		background: #F3961F;
		width: 100%;
		height: 45px;
		border-radius: 10px;
		font-size: 18px;
		color: #FCFCFC;
		margin-top: 128px;
		text-align: center;
	}
</style>